#include<stdio.h>
int main() 
{ 
    int a,b,c;
    while(scanf("%d %d %d",&a,&b,&c)==3)
    {
        int d=(a*b)%c;
        printf("%d\n",d);
    }
    return 0; 
}
